Previous Book Contents Book Index Next

Inside Macintosh: QuickDraw GX Objects /
Chapter 1 - Introduction to QuickDraw GX / Objects and Memory


Direct Access to Object Structure: Locking and Unlocking

Normally, to modify a property of an object takes three steps. First, you make a function call to obtain a copy of the information in application memory. Then you modify the information. Finally, you make another function call to place that information back into the object in QuickDraw GX memory.

As a convenience, QuickDraw GX allows you to directly access parts of certain objects in QuickDraw GX memory in three specific situations: you can manipulate the geometric structure of a shape object, you can manipulate the profile data of a color profile object, and you can manipulate the contents of a tag object, without first having to work on copies of the data in application memory.

This direct manipulation is convenient, especially if you want to avoid copying large amounts of information, but it has a price. You must first lock the item you are accessing, so that it cannot be moved while you are working on it. When you have finished your alterations, you must be sure to unlock the item so that QuickDraw GX is free to relocate it. In the case of shape geometry, you must then make an additional call to QuickDraw GX to notify it that you have changed the shape.

Another drawback is that you cannot change the size of the item you are manipulating. If you need to make a shape's geometry or a tag's contents larger or smaller, you need to access the information in the normal way, through QuickDraw GX functions.

Remember also that locking an object fragments the QuickDraw GX heap, which can result in lower performance and possibly an error condition. Furthermore, in low-memory conditions, QuickDraw GX can actually unlock locked objects and move them if it needs to.

For information about locking shape objects, see the chapter "Shape Objects" in this book. For information about locking color profile objects, see the chapter "Colors and Color-Related Objects" in this book. For information about locking tag objects, see the chapter "Tag Objects" in this book.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
7 JUL 1996